<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100%;
        }
        p{
            height: 30px;
            width: 100px;
            margin: 0 auto;
        }
        
    </style>
</head>
<body>  
   <div>
    <p><input type="text" value="北京市" name="" id=""></p>
    <p><input type="text" value="朝阳区" name="" id=""></p>
    <p><button>传参</button></button></p>
   </div>
   <script>
       var myFn = function (a,b){
        alert(a.value)
        alert(b.value)
       }

        window.onload = function (){
            var inp = document.getElementsByTagName('input');
            var but = document.getElementsByTagName('button')[0];

            but.onclick=function(){
                myFn(inp[0],inp[1])
            }
        }



   </script>
    
    
</body>
</html>